package com.etime.dao.impl;

import com.etime.dao.StudentEnrollDao;
import com.etime.entity.Student;
import com.etime.util.C3P0Util;
import org.apache.commons.dbutils.QueryRunner;

public class StudentEnrollDaoImpl implements StudentEnrollDao {

  @Override
  public int enroll(String name,String password) {
    int update = -1;
    try {
      QueryRunner queryRunner = new QueryRunner(C3P0Util.getDataSource());
      String sql = "insert into student values(?,?)";
      update = queryRunner.update(sql, name, password);
    }
    catch (Exception e){
      System.out.println(e);
    }
    return update;
  }
}
